package com.ningmengs789.live.utils;

import com.ningmengs789.live.R;

public class ASXUtil {

    public static String[] sexSS = new String[]{
            "CD",
            "TS",
            "ZN",
            "TG",
            "女"
    };

    public static int[] shuxingBG = new int[]{
            R.drawable.ssl_cd,
            R.drawable.ssl_ts,
            R.drawable.ssl_zn,
            R.drawable.ssl_tg,
            R.drawable.ssl_nv
    };

    public static String[] shuxingSS = new String[]{
            "未知",
            "S",
            "M"
    };


    /**
     * 类型转位置
     *
     * @return
     */
    public static int getS_P(String s){
        int pos = 0;
        for (int i = 0; i < sexSS.length; i++) {
            if (s.equals(sexSS[i])){
                pos = i;
                break;
            }
        }
        return pos + 1;
    }

    /**
     * 位置转类型
     *
     * @return
     */
    public static String getP_S(int p){
        int pos = p - 1;
        if (pos >= 0 && pos < sexSS.length){
            return sexSS[pos];
        }else {
            return sexSS[0];
        }
    }

    /**
     * 位置转背景色
     * @param p
     * @return
     */
    public static int getP_BG(int p){
        int pos = p - 1;
        if (pos >= 0 && pos < shuxingBG.length){
            return shuxingBG[pos];
        }else {
            return shuxingBG[0];
        }
    }





    /**
     * 属性转位置
     *
     * @return
     */
    public static int getShu_P(String s){
        int pos = 0;
        for (int i = 0; i < shuxingSS.length; i++) {
            if (s.equals(shuxingSS[i])){
                pos = i;
                break;
            }
        }
        return pos;
    }

    /**
     * 位置转属性
     *
     * @return
     */
    public static String getP_Shu(int p){
        if (p >= 0 && p < shuxingSS.length){
            return shuxingSS[p];
        }else {
            return shuxingSS[0];
        }
    }

}
